package com.wxy.config;

import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 47868
 */
@Configuration
public class RabbitmqConfig {
    @Bean
    public Queue queue() {
        return new Queue("wxy.queue3");
    }
    @Bean
    public FanoutExchange fanoutExchange() {
        return new FanoutExchange("wxy.fanout");
    }
    @Bean
    public Binding binding(FanoutExchange fanoutExchange, Queue queue) {
        return BindingBuilder.bind(queue).to(fanoutExchange);
    }
    /*@Bean
    public DirectExchange directExchange() {
        return new DirectExchange("wxy.direct");
    }
    @Bean
    //在设置routing时只能设置单个，使用注解来绑定队列
    public Binding bind(DirectExchange directExchange, Queue queue) {
        return BindingBuilder.bind(queue).to(directExchange).with("red");
    }*/
}
